﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace WCS.Infrastructure.EFCore;

/// <summary>
/// 抽奖活动表
/// </summary>
[Table("LotteryActivity")]
[Index("ActivityCode", Name = "LotteryActivity_Code_unique", IsUnique = true)]
[Index("StartTime", "EndTime", "Status", Name = "idx_LotteryActivity_TimeRange")]
public partial class LotteryActivity
{
    /// <summary>
    /// 活动ID
    /// </summary>
    [Key]
    [StringLength(32)]
    public string Id { get; set; } = null!;

    /// <summary>
    /// 活动编号
    /// </summary>
    [StringLength(32)]
    public string ActivityCode { get; set; } = null!;

    /// <summary>
    /// 活动名称
    /// </summary>
    [StringLength(64)]
    public string Name { get; set; } = null!;

    /// <summary>
    /// 活动状态：1=草稿，2=上架，3=下架
    /// </summary>
    public int Status { get; set; }

    /// <summary>
    /// 活动开始时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime StartTime { get; set; }

    /// <summary>
    /// 活动结束时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime EndTime { get; set; }

    /// <summary>
    /// 渠道/入口
    /// </summary>
    [StringLength(32)]
    public string? Channel { get; set; }

    /// <summary>
    /// 配置版本号（前后端一致性校验）
    /// </summary>
    [StringLength(32)]
    public string? ConfigVersion { get; set; }

    /// <summary>
    /// 用户每日参与次数上限（0=不限）
    /// </summary>
    public int DailyLimit { get; set; }

    /// <summary>
    /// 用户在活动期间总参与次数上限（0=不限）
    /// </summary>
    public int TotalLimit { get; set; }

    /// <summary>
    /// 参与冷却时间（秒）
    /// </summary>
    public int CooldownSeconds { get; set; }

    /// <summary>
    /// 启用状态：0=禁用，1=启用
    /// </summary>
    public int EnableStatus { get; set; }

    /// <summary>
    /// 扩展属性（JSON文本）
    /// </summary>
    public string? ExtraProperties { get; set; }

    /// <summary>
    /// 并发标记
    /// </summary>
    [StringLength(40)]
    public string? ConcurrencyStamp { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime CreationTime { get; set; }

    /// <summary>
    /// 创建人ID
    /// </summary>
    [StringLength(32)]
    public string? CreatorId { get; set; }

    /// <summary>
    /// 最后修改时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime? LastModificationTime { get; set; }

    /// <summary>
    /// 最后修改人ID
    /// </summary>
    [StringLength(32)]
    public string? LastModifierId { get; set; }

    /// <summary>
    /// 是否删除
    /// </summary>
    public bool IsDeleted { get; set; }

    /// <summary>
    /// 删除人ID
    /// </summary>
    [StringLength(32)]
    public string? DeleterId { get; set; }

    /// <summary>
    /// 删除时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime? DeletionTime { get; set; }

    /// <summary>
    /// 活动类型：0=默认，1=九宫格，2=转盘
    /// </summary>
    public int Type { get; set; }

    /// <summary>
    /// 活动规则
    /// </summary>
    public string? ActivityRules { get; set; }

    /// <summary>
    /// 是否需要登记手机号
    /// </summary>
    public bool RegisterPhone { get; set; }

    /// <summary>
    /// 是否需要登记身份证
    /// </summary>
    public bool RegisterIdentityCard { get; set; }

    /// <summary>
    /// 过期时间（单位秒）
    /// </summary>
    public int? ExpirationTime { get; set; }
}
